package com.zhao.service.serviceImpl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zhao.mapper.ArticleMapper;
import com.zhao.pojo.Article;
import com.zhao.service.ArticleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service
public class ArticleServiceImpl extends ServiceImpl<ArticleMapper, Article> implements ArticleService {
    @Autowired
    ArticleMapper articleMapper;
    @Override
    public List<Article> host(int i) {
        return articleMapper.host(i);
    }

    @Override
    public Page<Article> selectListPage(int current, int number,String like,String author,String show) {
        // 新建分页
        Page<Article> page = new Page<Article>(current, number);

        // 返回分页结果 1为id
        return page.setRecords(this.baseMapper.dyGetUserList(page,like,author,show));
    }

    @Override
    public Article dyOne(Integer id) {
        return articleMapper.dyOne(id);
    }

    @Override
    public Page<Article> selectListPageTop(Integer current, Integer number, String like, String author) {
        // 新建分页
        Page<Article> page = new Page<Article>(current, number);

        // 返回分页结果 1为id
        return page.setRecords(this.baseMapper.dyGetUserListTop(page,like,author));
    }

    @Override
    public String listTop(String userAccount) {
        return articleMapper.listTop(userAccount);
    }

    @Override
    public List<Article> selectListTop(String like, String userAccount) {
        return articleMapper.selectListTop(like,userAccount);
    }


}
